﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Globalization;

namespace Dzzzr
{
	/// <summary>
	/// Converter for user friendly string in value
	/// </summary>
	class BinaryTypeConverter : TypeConverter
	{
		/// <summary>
		/// Type to convert
		/// </summary>
		/// <param name="context"></param>
		/// <param name="destType"></param>
		/// <returns></returns>
		public override bool CanConvertTo(ITypeDescriptorContext context, Type destType)
		{
			return destType == typeof(string);
		}

		/// <summary>
		/// Convert
		/// </summary>
		/// <param name="context"></param>
		/// <param name="culture"></param>
		/// <param name="value"></param>
		/// <param name="destType"></param>
		/// <returns></returns>
		public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
		{
			if (value != null)
				return "(Image)";
			else
				return string.Empty;
		}
	}
}
